<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - ged.info - gil/step_iterator.hpp</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../index.html">directory</a> - <a href="index.html">gil</a> - step_iterator.hpp</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>ged.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2009-06-09</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">22</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">90.9 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">20</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : /*
<span class="lineNum">       2 </span>                :     Copyright 2005-2007 Adobe Systems Incorporated
<span class="lineNum">       3 </span>                :    
<span class="lineNum">       4 </span>                :     Use, modification and distribution are subject to the Boost Software License,
<span class="lineNum">       5 </span>                :     Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
<span class="lineNum">       6 </span>                :     http://www.boost.org/LICENSE_1_0.txt).
<span class="lineNum">       7 </span>                : 
<span class="lineNum">       8 </span>                :     See http://opensource.adobe.com/gil for most recent version including documentation.
<span class="lineNum">       9 </span>                : */
<span class="lineNum">      10 </span>                : 
<span class="lineNum">      11 </span>                : /*************************************************************************************************/
<span class="lineNum">      12 </span>                : 
<span class="lineNum">      13 </span>                : #ifndef GIL_STEP_ITERATOR_H
<span class="lineNum">      14 </span>                : #define GIL_STEP_ITERATOR_H
<span class="lineNum">      15 </span>                : 
<span class="lineNum">      16 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">      17 </span>                : /// \file               
<span class="lineNum">      18 </span>                : /// \brief pixel step iterator
<span class="lineNum">      19 </span>                : /// \author Lubomir Bourdev and Hailin Jin \n
<span class="lineNum">      20 </span>                : ///         Adobe Systems Incorporated
<span class="lineNum">      21 </span>                : /// \date   2005-2007 \n Last updated on September 18, 2007
<span class="lineNum">      22 </span>                : ///
<span class="lineNum">      23 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">      24 </span>                : 
<span class="lineNum">      25 </span>                : #include &lt;cstddef&gt;
<span class="lineNum">      26 </span>                : #include &lt;iterator&gt;
<span class="lineNum">      27 </span>                : #include &lt;boost/iterator/iterator_facade.hpp&gt;
<span class="lineNum">      28 </span>                : #include &quot;gil_config.hpp&quot;
<span class="lineNum">      29 </span>                : #include &quot;utilities.hpp&quot;
<span class="lineNum">      30 </span>                : #include &quot;pixel_iterator.hpp&quot;
<span class="lineNum">      31 </span>                : #include &quot;pixel_iterator_adaptor.hpp&quot;
<span class="lineNum">      32 </span>                : 
<span class="lineNum">      33 </span>                : namespace boost { namespace gil {
<span class="lineNum">      34 </span>                : 
<span class="lineNum">      35 </span>                : /// \defgroup PixelIteratorModelStepPtr step iterators
<span class="lineNum">      36 </span>                : /// \ingroup PixelIteratorModel
<span class="lineNum">      37 </span>                : /// \brief Iterators that allow for specifying the step between two adjacent values
<span class="lineNum">      38 </span>                : 
<span class="lineNum">      39 </span>                : 
<span class="lineNum">      40 </span>                : namespace detail {
<span class="lineNum">      41 </span>                : 
<span class="lineNum">      42 </span>                : /// \ingroup PixelIteratorModelStepPtr
<span class="lineNum">      43 </span>                : /// \brief An adaptor over an existing iterator that changes the step unit
<span class="lineNum">      44 </span>                : ///
<span class="lineNum">      45 </span>                : /// (i.e. distance(it,it+1)) by a given predicate. Instead of calling base's 
<span class="lineNum">      46 </span>                : /// operators ++, --, +=, -=, etc. the adaptor is using the passed policy object SFn
<span class="lineNum">      47 </span>                : /// for advancing and for computing the distance between iterators.
<span class="lineNum">      48 </span>                : 
<span class="lineNum">      49 </span>                : template &lt;typename Derived,  // type of the derived class
<span class="lineNum">      50 </span>                :           typename Iterator, // Models Iterator
<span class="lineNum">      51 </span>                :           typename SFn&gt;      // A policy object that can compute the distance between two iterators of type Iterator
<span class="lineNum">      52 </span>                :                              // and can advance an iterator of type Iterator a given number of Iterator's units  
<span class="lineNum">      53 </span>                : class step_iterator_adaptor : public iterator_adaptor&lt;Derived, Iterator, use_default, use_default, use_default, typename SFn::difference_type&gt; {
<span class="lineNum">      54 </span>                : public:
<span class="lineNum">      55 </span>                :     typedef iterator_adaptor&lt;Derived, Iterator, use_default, use_default, use_default, typename SFn::difference_type&gt; parent_t;
<span class="lineNum">      56 </span>                :     typedef typename std::iterator_traits&lt;Iterator&gt;::difference_type base_difference_type;
<span class="lineNum">      57 </span>                :     typedef typename SFn::difference_type                           difference_type;
<span class="lineNum">      58 </span>                :     typedef typename std::iterator_traits&lt;Iterator&gt;::reference       reference;
<span class="lineNum">      59 </span>                : 
<span class="lineNum">      60 </span>                :     step_iterator_adaptor() {}
<span class="lineNum">      61 </span><span class="lineCov">            140 :     step_iterator_adaptor(const Iterator&amp; it, SFn step_fn=SFn()) : parent_t(it), _step_fn(step_fn) {}</span>
<span class="lineNum">      62 </span>                : 
<span class="lineNum">      63 </span><span class="lineCov">            664 :     difference_type step() const { return _step_fn.step(); }</span>
<span class="lineNum">      64 </span>                : 
<span class="lineNum">      65 </span>                : protected:
<span class="lineNum">      66 </span>                :     SFn _step_fn;
<span class="lineNum">      67 </span>                : private:
<span class="lineNum">      68 </span>                :     friend class boost::iterator_core_access;
<span class="lineNum">      69 </span>                : 
<span class="lineNum">      70 </span>                :     void increment() { _step_fn.advance(this-&gt;base_reference(),1); }
<span class="lineNum">      71 </span>                :     void decrement() { _step_fn.advance(this-&gt;base_reference(),-1); }
<span class="lineNum">      72 </span>                :     void advance(base_difference_type d) { _step_fn.advance(this-&gt;base_reference(),d); }
<span class="lineNum">      73 </span>                :     difference_type distance_to(const step_iterator_adaptor&amp; it) const { return _step_fn.difference(this-&gt;base_reference(),it.base_reference()); }
<span class="lineNum">      74 </span>                : };
<span class="lineNum">      75 </span>                : 
<span class="lineNum">      76 </span>                : // although iterator_adaptor defines these, the default implementation computes distance and compares for zero.
<span class="lineNum">      77 </span>                : // it is often faster to just apply the relation operator to the base
<span class="lineNum">      78 </span>                : template &lt;typename D,typename Iterator,typename SFn&gt; inline
<span class="lineNum">      79 </span>                : bool operator&gt;(const step_iterator_adaptor&lt;D,Iterator,SFn&gt;&amp; p1, const step_iterator_adaptor&lt;D,Iterator,SFn&gt;&amp; p2) { 
<span class="lineNum">      80 </span>                :     return p1.step()&gt;0 ? p1.base()&gt; p2.base() : p1.base()&lt; p2.base(); 
<span class="lineNum">      81 </span>                : }
<span class="lineNum">      82 </span>                : 
<span class="lineNum">      83 </span>                : template &lt;typename D,typename Iterator,typename SFn&gt; inline
<span class="lineNum">      84 </span>                : bool operator&lt;(const step_iterator_adaptor&lt;D,Iterator,SFn&gt;&amp; p1, const step_iterator_adaptor&lt;D,Iterator,SFn&gt;&amp; p2) { 
<span class="lineNum">      85 </span>                :     return p1.step()&gt;0 ? p1.base()&lt; p2.base() : p1.base()&gt; p2.base(); 
<span class="lineNum">      86 </span>                : }
<span class="lineNum">      87 </span>                : 
<span class="lineNum">      88 </span>                : template &lt;typename D,typename Iterator,typename SFn&gt; inline
<span class="lineNum">      89 </span>                : bool operator&gt;=(const step_iterator_adaptor&lt;D,Iterator,SFn&gt;&amp; p1, const step_iterator_adaptor&lt;D,Iterator,SFn&gt;&amp; p2) { 
<span class="lineNum">      90 </span>                :     return p1.step()&gt;0 ? p1.base()&gt;=p2.base() : p1.base()&lt;=p2.base(); 
<span class="lineNum">      91 </span>                : }
<span class="lineNum">      92 </span>                : 
<span class="lineNum">      93 </span>                : template &lt;typename D,typename Iterator,typename SFn&gt; inline
<span class="lineNum">      94 </span>                : bool operator&lt;=(const step_iterator_adaptor&lt;D,Iterator,SFn&gt;&amp; p1, const step_iterator_adaptor&lt;D,Iterator,SFn&gt;&amp; p2) { 
<span class="lineNum">      95 </span>                :     return p1.step()&gt;0 ? p1.base()&lt;=p2.base() : p1.base()&gt;=p2.base(); 
<span class="lineNum">      96 </span>                : }
<span class="lineNum">      97 </span>                : 
<span class="lineNum">      98 </span>                : template &lt;typename D,typename Iterator,typename SFn&gt; inline
<span class="lineNum">      99 </span><span class="lineCov">             24 : bool operator==(const step_iterator_adaptor&lt;D,Iterator,SFn&gt;&amp; p1, const step_iterator_adaptor&lt;D,Iterator,SFn&gt;&amp; p2) { </span>
<span class="lineNum">     100 </span><span class="lineCov">             24 :     return p1.base()==p2.base(); </span>
<span class="lineNum">     101 </span>                : }
<span class="lineNum">     102 </span>                : 
<span class="lineNum">     103 </span>                : template &lt;typename D,typename Iterator,typename SFn&gt; inline
<span class="lineNum">     104 </span>                : bool operator!=(const step_iterator_adaptor&lt;D,Iterator,SFn&gt;&amp; p1, const step_iterator_adaptor&lt;D,Iterator,SFn&gt;&amp; p2) { 
<span class="lineNum">     105 </span>                :     return p1.base()!=p2.base(); 
<span class="lineNum">     106 </span>                : }
<span class="lineNum">     107 </span>                : 
<span class="lineNum">     108 </span>                : } // namespace detail
<span class="lineNum">     109 </span>                : 
<span class="lineNum">     110 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">     111 </span>                : ///                 MEMORY-BASED STEP ITERATOR
<span class="lineNum">     112 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">     113 </span>                : 
<span class="lineNum">     114 </span>                : /// \class memory_based_step_iterator
<span class="lineNum">     115 </span>                : /// \ingroup PixelIteratorModelStepPtr PixelBasedModel
<span class="lineNum">     116 </span>                : /// \brief Iterator with dynamically specified step in memory units (bytes or bits). Models StepIteratorConcept, IteratorAdaptorConcept, MemoryBasedIteratorConcept, PixelIteratorConcept, HasDynamicXStepTypeConcept
<span class="lineNum">     117 </span>                : ///
<span class="lineNum">     118 </span>                : /// A refinement of step_iterator_adaptor that uses a dynamic parameter for the step 
<span class="lineNum">     119 </span>                : /// which is specified in memory units, such as bytes or bits
<span class="lineNum">     120 </span>                : ///
<span class="lineNum">     121 </span>                : /// Pixel step iterators are used to provide iteration over non-adjacent pixels. 
<span class="lineNum">     122 </span>                : /// Common use is a vertical traversal, where the step is the row stride.
<span class="lineNum">     123 </span>                : ///
<span class="lineNum">     124 </span>                : /// Another application is as a sub-channel view. For example, a red intensity image over 
<span class="lineNum">     125 </span>                : /// interleaved RGB data would use a step iterator adaptor with step sizeof(channel_t)*3
<span class="lineNum">     126 </span>                : /// In the latter example the step size could be fixed at compile time for efficiency.
<span class="lineNum">     127 </span>                : /// Compile-time fixed step can be implemented by providing a step function object that takes the step as a template
<span class="lineNum">     128 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">     129 </span>                : 
<span class="lineNum">     130 </span>                : /// \ingroup PixelIteratorModelStepPtr
<span class="lineNum">     131 </span>                : /// \brief function object that returns the memory unit distance between two iterators and advances a given iterator a given number of mem units (bytes or bits)
<span class="lineNum">     132 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     133 </span>                : struct memunit_step_fn {
<span class="lineNum">     134 </span>                :     typedef std::ptrdiff_t difference_type;
<span class="lineNum">     135 </span>                : 
<span class="lineNum">     136 </span><span class="lineCov">            140 :     memunit_step_fn(difference_type step=memunit_step(Iterator())) : _step(step) {}</span>
<span class="lineNum">     137 </span>                : 
<span class="lineNum">     138 </span>                :     difference_type difference(const Iterator&amp; it1, const Iterator&amp; it2) const { return memunit_distance(it1,it2)/_step; }
<span class="lineNum">     139 </span>                :     void            advance(Iterator&amp; it, difference_type d)             const { memunit_advance(it,d*_step); } 
<span class="lineNum">     140 </span><span class="lineCov">            664 :     difference_type step()                                               const { return _step; }</span>
<span class="lineNum">     141 </span>                : 
<span class="lineNum">     142 </span>                :     void            set_step(std::ptrdiff_t step) { _step=step; }
<span class="lineNum">     143 </span>                : private:
<span class="lineNum">     144 </span>                :     GIL_CLASS_REQUIRE(Iterator, boost::gil, MemoryBasedIteratorConcept)
<span class="lineNum">     145 </span>                :     difference_type _step;
<span class="lineNum">     146 </span>                : };
<span class="lineNum">     147 </span>                : 
<span class="lineNum">     148 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     149 </span>                : class memory_based_step_iterator : public detail::step_iterator_adaptor&lt;memory_based_step_iterator&lt;Iterator&gt;, 
<span class="lineNum">     150 </span>                :                                                                             Iterator, 
<span class="lineNum">     151 </span>                :                                                                             memunit_step_fn&lt;Iterator&gt; &gt; {
<span class="lineNum">     152 </span>                :     GIL_CLASS_REQUIRE(Iterator, boost::gil, MemoryBasedIteratorConcept)
<span class="lineNum">     153 </span>                : public:
<span class="lineNum">     154 </span>                :     typedef detail::step_iterator_adaptor&lt;memory_based_step_iterator&lt;Iterator&gt;, 
<span class="lineNum">     155 </span>                :                                           Iterator, 
<span class="lineNum">     156 </span>                :                                           memunit_step_fn&lt;Iterator&gt; &gt; parent_t;
<span class="lineNum">     157 </span>                :     typedef typename parent_t::reference                            reference;
<span class="lineNum">     158 </span>                :     typedef typename parent_t::difference_type                      difference_type;
<span class="lineNum">     159 </span>                :     typedef Iterator                                                x_iterator;
<span class="lineNum">     160 </span>                : 
<span class="lineNum">     161 </span><span class="lineCov">             83 :     memory_based_step_iterator() : parent_t(Iterator()) {}</span>
<span class="lineNum">     162 </span><span class="lineCov">             71 :     memory_based_step_iterator(Iterator it, std::ptrdiff_t memunit_step) : parent_t(it, memunit_step_fn&lt;Iterator&gt;(memunit_step)) {}</span>
<span class="lineNum">     163 </span>                :     template &lt;typename I2&gt; 
<span class="lineNum">     164 </span>                :     memory_based_step_iterator(const memory_based_step_iterator&lt;I2&gt;&amp; it)
<span class="lineNum">     165 </span>                :         : parent_t(it.base(), memunit_step_fn&lt;Iterator&gt;(it.step())) {}
<span class="lineNum">     166 </span>                : 
<span class="lineNum">     167 </span>                :     /// For some reason operator[] provided by iterator_adaptor returns a custom class that is convertible to reference
<span class="lineNum">     168 </span>                :     /// We require our own reference because it is registered in iterator_traits
<span class="lineNum">     169 </span>                :     reference operator[](difference_type d) const { return *(*this+d); }
<span class="lineNum">     170 </span>                : 
<span class="lineNum">     171 </span>                :     void set_step(std::ptrdiff_t memunit_step) { this-&gt;_step_fn.set_step(memunit_step); }
<span class="lineNum">     172 </span>                : 
<span class="lineNum">     173 </span><span class="lineCov">             80 :     x_iterator&amp; base()              { return parent_t::base_reference(); }</span>
<span class="lineNum">     174 </span><span class="lineCov">           1170 :     x_iterator const&amp; base() const  { return parent_t::base_reference(); }</span>
<span class="lineNum">     175 </span>                : };
<span class="lineNum">     176 </span>                : 
<span class="lineNum">     177 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     178 </span>                : struct const_iterator_type&lt;memory_based_step_iterator&lt;Iterator&gt; &gt; {
<span class="lineNum">     179 </span>                :     typedef memory_based_step_iterator&lt;typename const_iterator_type&lt;Iterator&gt;::type&gt;  type;
<span class="lineNum">     180 </span>                : };
<span class="lineNum">     181 </span>                : 
<span class="lineNum">     182 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     183 </span>                : struct iterator_is_mutable&lt;memory_based_step_iterator&lt;Iterator&gt; &gt; : public iterator_is_mutable&lt;Iterator&gt; {};
<span class="lineNum">     184 </span>                : 
<span class="lineNum">     185 </span>                : 
<span class="lineNum">     186 </span>                : /////////////////////////////
<span class="lineNum">     187 </span>                : //  IteratorAdaptorConcept
<span class="lineNum">     188 </span>                : /////////////////////////////
<span class="lineNum">     189 </span>                : 
<span class="lineNum">     190 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     191 </span>                : struct is_iterator_adaptor&lt;memory_based_step_iterator&lt;Iterator&gt; &gt; : public mpl::true_{};
<span class="lineNum">     192 </span>                : 
<span class="lineNum">     193 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     194 </span>                : struct iterator_adaptor_get_base&lt;memory_based_step_iterator&lt;Iterator&gt; &gt; {
<span class="lineNum">     195 </span>                :     typedef Iterator type;
<span class="lineNum">     196 </span>                : };
<span class="lineNum">     197 </span>                : 
<span class="lineNum">     198 </span>                : template &lt;typename Iterator, typename NewBaseIterator&gt;
<span class="lineNum">     199 </span>                : struct iterator_adaptor_rebind&lt;memory_based_step_iterator&lt;Iterator&gt;,NewBaseIterator&gt; {
<span class="lineNum">     200 </span>                :     typedef memory_based_step_iterator&lt;NewBaseIterator&gt; type;
<span class="lineNum">     201 </span>                : };
<span class="lineNum">     202 </span>                : 
<span class="lineNum">     203 </span>                : /////////////////////////////
<span class="lineNum">     204 </span>                : //  PixelBasedConcept
<span class="lineNum">     205 </span>                : /////////////////////////////
<span class="lineNum">     206 </span>                : 
<span class="lineNum">     207 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     208 </span>                : struct color_space_type&lt;memory_based_step_iterator&lt;Iterator&gt; &gt; : public color_space_type&lt;Iterator&gt; {};
<span class="lineNum">     209 </span>                : 
<span class="lineNum">     210 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     211 </span>                : struct channel_mapping_type&lt;memory_based_step_iterator&lt;Iterator&gt; &gt; : public channel_mapping_type&lt;Iterator&gt; {};
<span class="lineNum">     212 </span>                : 
<span class="lineNum">     213 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     214 </span>                : struct is_planar&lt;memory_based_step_iterator&lt;Iterator&gt; &gt; : public is_planar&lt;Iterator&gt; {};
<span class="lineNum">     215 </span>                : 
<span class="lineNum">     216 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     217 </span>                : struct channel_type&lt;memory_based_step_iterator&lt;Iterator&gt; &gt; : public channel_type&lt;Iterator&gt; {};
<span class="lineNum">     218 </span>                : 
<span class="lineNum">     219 </span>                : /////////////////////////////
<span class="lineNum">     220 </span>                : //  MemoryBasedIteratorConcept
<span class="lineNum">     221 </span>                : /////////////////////////////
<span class="lineNum">     222 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     223 </span>                : struct byte_to_memunit&lt;memory_based_step_iterator&lt;Iterator&gt; &gt; : public byte_to_memunit&lt;Iterator&gt; {};
<span class="lineNum">     224 </span>                : 
<span class="lineNum">     225 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     226 </span><span class="lineCov">            664 : inline std::ptrdiff_t memunit_step(const memory_based_step_iterator&lt;Iterator&gt;&amp; p) { return p.step(); }</span>
<span class="lineNum">     227 </span>                : 
<span class="lineNum">     228 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     229 </span>                : inline std::ptrdiff_t memunit_distance(const memory_based_step_iterator&lt;Iterator&gt;&amp; p1, 
<span class="lineNum">     230 </span>                :                                     const memory_based_step_iterator&lt;Iterator&gt;&amp; p2) { 
<span class="lineNum">     231 </span>                :     return memunit_distance(p1.base(),p2.base()); 
<span class="lineNum">     232 </span>                : }
<span class="lineNum">     233 </span>                : 
<span class="lineNum">     234 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     235 </span>                : inline void memunit_advance(memory_based_step_iterator&lt;Iterator&gt;&amp; p, 
<span class="lineNum">     236 </span><span class="lineCov">             22 :                          std::ptrdiff_t diff) { </span>
<span class="lineNum">     237 </span><span class="lineCov">             22 :     memunit_advance(p.base(), diff);</span>
<span class="lineNum">     238 </span><span class="lineCov">             22 : }</span>
<span class="lineNum">     239 </span>                : 
<span class="lineNum">     240 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     241 </span>                : inline memory_based_step_iterator&lt;Iterator&gt; 
<span class="lineNum">     242 </span>                : memunit_advanced(const memory_based_step_iterator&lt;Iterator&gt;&amp; p, 
<span class="lineNum">     243 </span>                :               std::ptrdiff_t diff) {
<span class="lineNum">     244 </span>                :     return memory_based_step_iterator&lt;Iterator&gt;(memunit_advanced(p.base(), diff),p.step());
<span class="lineNum">     245 </span>                : }
<span class="lineNum">     246 </span>                : 
<span class="lineNum">     247 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     248 </span>                : inline typename std::iterator_traits&lt;Iterator&gt;::reference 
<span class="lineNum">     249 </span>                : memunit_advanced_ref(const memory_based_step_iterator&lt;Iterator&gt;&amp; p, 
<span class="lineNum">     250 </span><span class="lineNoCov">              0 :                   std::ptrdiff_t diff) { </span>
<span class="lineNum">     251 </span><span class="lineNoCov">              0 :     return memunit_advanced_ref(p.base(), diff);</span>
<span class="lineNum">     252 </span>                : }
<span class="lineNum">     253 </span>                : 
<span class="lineNum">     254 </span>                : /////////////////////////////
<span class="lineNum">     255 </span>                : //  HasDynamicXStepTypeConcept
<span class="lineNum">     256 </span>                : /////////////////////////////
<span class="lineNum">     257 </span>                : 
<span class="lineNum">     258 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">     259 </span>                : struct dynamic_x_step_type&lt;memory_based_step_iterator&lt;Iterator&gt; &gt; {
<span class="lineNum">     260 </span>                :     typedef memory_based_step_iterator&lt;Iterator&gt; type;
<span class="lineNum">     261 </span>                : };
<span class="lineNum">     262 </span>                : 
<span class="lineNum">     263 </span>                : // For step iterators, pass the function object to the base
<span class="lineNum">     264 </span>                : template &lt;typename Iterator, typename Deref&gt;
<span class="lineNum">     265 </span>                : struct iterator_add_deref&lt;memory_based_step_iterator&lt;Iterator&gt;,Deref&gt; {
<span class="lineNum">     266 </span>                :     GIL_CLASS_REQUIRE(Deref, boost::gil, PixelDereferenceAdaptorConcept)
<span class="lineNum">     267 </span>                : 
<span class="lineNum">     268 </span>                :     typedef memory_based_step_iterator&lt;typename iterator_add_deref&lt;Iterator, Deref&gt;::type&gt; type;
<span class="lineNum">     269 </span>                : 
<span class="lineNum">     270 </span>                :     static type make(const memory_based_step_iterator&lt;Iterator&gt;&amp; it, const Deref&amp; d) { return type(iterator_add_deref&lt;Iterator, Deref&gt;::make(it.base(),d),it.step()); }
<span class="lineNum">     271 </span>                : };
<span class="lineNum">     272 </span>                : 
<span class="lineNum">     273 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">     274 </span>                : /// make_step_iterator
<span class="lineNum">     275 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">     276 </span>                : 
<span class="lineNum">     277 </span>                : template &lt;typename I&gt; typename dynamic_x_step_type&lt;I&gt;::type make_step_iterator(const I&amp; it, std::ptrdiff_t step);
<span class="lineNum">     278 </span>                : 
<span class="lineNum">     279 </span>                : namespace detail {
<span class="lineNum">     280 </span>                : 
<span class="lineNum">     281 </span>                : // if the iterator is a plain base iterator (non-adaptor), wraps it in memory_based_step_iterator
<span class="lineNum">     282 </span>                : template &lt;typename I&gt; 
<span class="lineNum">     283 </span><span class="lineCov">             30 : typename dynamic_x_step_type&lt;I&gt;::type make_step_iterator_impl(const I&amp; it, std::ptrdiff_t step, mpl::false_) {</span>
<span class="lineNum">     284 </span><span class="lineCov">             30 :     return memory_based_step_iterator&lt;I&gt;(it, step);</span>
<span class="lineNum">     285 </span>                : }
<span class="lineNum">     286 </span>                : 
<span class="lineNum">     287 </span>                : // If the iterator is compound, put the step in its base
<span class="lineNum">     288 </span>                : template &lt;typename I&gt; 
<span class="lineNum">     289 </span>                : typename dynamic_x_step_type&lt;I&gt;::type make_step_iterator_impl(const I&amp; it, std::ptrdiff_t step, mpl::true_) {
<span class="lineNum">     290 </span>                :     return make_step_iterator(it.base(), step);
<span class="lineNum">     291 </span>                : }
<span class="lineNum">     292 </span>                : 
<span class="lineNum">     293 </span>                : // If the iterator is memory_based_step_iterator, change the step
<span class="lineNum">     294 </span>                : template &lt;typename BaseIt&gt; 
<span class="lineNum">     295 </span><span class="lineCov">             15 : memory_based_step_iterator&lt;BaseIt&gt; make_step_iterator_impl(const memory_based_step_iterator&lt;BaseIt&gt;&amp; it, std::ptrdiff_t step, mpl::true_) {</span>
<span class="lineNum">     296 </span><span class="lineCov">             15 :     return memory_based_step_iterator&lt;BaseIt&gt;(it.base(), step);</span>
<span class="lineNum">     297 </span>                : }
<span class="lineNum">     298 </span>                : }
<span class="lineNum">     299 </span>                : 
<span class="lineNum">     300 </span>                : /// \brief Constructs a step iterator from a base iterator and a step.
<span class="lineNum">     301 </span>                : ///
<span class="lineNum">     302 </span>                : /// To construct a step iterator from a given iterator Iterator and a given step, if Iterator does not
<span class="lineNum">     303 </span>                : /// already have a dynamic step, we wrap it in a memory_based_step_iterator. Otherwise we 
<span class="lineNum">     304 </span>                : /// do a compile-time traversal of the chain of iterator adaptors to locate the step iterator
<span class="lineNum">     305 </span>                : /// and then set it step to the new one.
<span class="lineNum">     306 </span>                : ///
<span class="lineNum">     307 </span>                : /// The step iterator of Iterator is not always memory_based_step_iterator&lt;Iterator&gt;. For example, Iterator may
<span class="lineNum">     308 </span>                : /// already be a memory_based_step_iterator, in which case it will be inefficient to stack them;
<span class="lineNum">     309 </span>                : /// we can obtain the same result by multiplying their steps. Note that for Iterator to be a
<span class="lineNum">     310 </span>                : /// step iterator it does not necessarily have to have the form memory_based_step_iterator&lt;J&gt;.
<span class="lineNum">     311 </span>                : /// The step iterator can be wrapped inside another iterator. Also, it may not have the
<span class="lineNum">     312 </span>                : /// type memory_based_step_iterator, but it could be a user-provided type.
<span class="lineNum">     313 </span>                : template &lt;typename I&gt;  // Models MemoryBasedIteratorConcept, HasDynamicXStepTypeConcept
<span class="lineNum">     314 </span><span class="lineCov">             45 : typename dynamic_x_step_type&lt;I&gt;::type make_step_iterator(const I&amp; it, std::ptrdiff_t step) {</span>
<span class="lineNum">     315 </span><span class="lineCov">             45 :     return detail::make_step_iterator_impl(it, step, typename is_iterator_adaptor&lt;I&gt;::type());</span>
<span class="lineNum">     316 </span>                : }
<span class="lineNum">     317 </span>                : 
<span class="lineNum">     318 </span>                : } }  // namespace boost::gil
<span class="lineNum">     319 </span>                : 
<span class="lineNum">     320 </span>                : #endif
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
